<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网站管理员列表</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <include file="Index/common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>管理员列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link"  href="javascript:location.replace(location.href);" title="刷新">
                            <i class="fa fa-refresh"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-1 m-b-xs">
                            <a   onclick="Admin_add('管理员添加','admin_add.html',800,600);" class="btn btn-w-m btn-success">添加</a>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th> </th>
                                <th>管理员名称</th>
                                <th>登陆邮箱</th>
                                <th>角色名</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <foreach name="data" item="data">
                                <tr>
                                    <td>
                                        <!--<input type="checkbox" class="i-checks" name="input[]">-->
                                    </td>
                                    <td>{$data.user_name}</td>
                                    <td>{$data.user_email}</td>
                                    <td>{$data.role_name}</td>
                                    <td>
                                        <a title="编辑" onclick="Admin_save('编辑','admin_save/id/{$data.user_id}',800,600);"><i class="fa fa-search-plus text-navy"></i></a>
                                        <a title="删除"  onclick="Admin_delete(this,'{$data.user_id}');"><i class="fa fa-trash text-navy"></i></a>
                                    </td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<include file="Index/common_js"/>
<!-- Peity -->
<script src="__PUBLIC__/admin/js/plugins/peity/jquery.peity.min.js"></script>
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/common/js/layer_show.js"></script>

<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<!-- Peity -->
<script src="__PUBLIC__/admin/js/demo/peity-demo.js"></script>
<script>
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });

    function Admin_delete(obj,id) {
        layer.confirm('确认删除吗？', function () {
            if (id == '') {
                layer.msg('操作错误，请刷新再试');
                return false;
            } else {
                var index = layer.load();
                $.ajax({
                    type:"POST",
                    url:"__MODULE__/Admin/Admin_delete",
                    dataType:'json',
                    data:{id:id},
                    success:function(data){
                        //console.log(data);
                        //alert(JSON.stringify(data));return;
                        layer.close(index);
                        if(data.status==1){
                            layer.msg(data.msg);
                            $(obj).parents("tr").remove();
                        }else if(data.status==0){
                            layer.msg(data.msg,{icon: 2, time: 2000});
                        }else{
                            layer.msg('网络错误',{icon: 2, time: 2000});
                        }
                    },error:function(err){
                        //console.log(err);
                        layer.close(index);
                        layer.msg('error:网络错误',{icon: 2, time: 2000});
                    }
                });
            }
        })
    }

    function Admin_add(t,u,w,h) {
       layer_show(t,u,w,h);
    }
    function Admin_save(t,u,w,h) {
           layer_show(t,u,w,h);
    }

</script>
</body>
</html>
